using System.ComponentModel.DataAnnotations;

namespace StudentManagement.Application.DTOs;

public class CourseDTO
{
    public int Id { get; set; }
    
    [Required(ErrorMessage = "课程代码不能为空")]
    [StringLength(20, ErrorMessage = "课程代码长度不能超过20个字符")]
    public string CourseCode { get; set; }
    
    [Required(ErrorMessage = "课程名称不能为空")]
    [StringLength(100, ErrorMessage = "课程名称长度不能超过100个字符")]
    public string CourseName { get; set; }
    
    [Required(ErrorMessage = "学分不能为空")]
    [Range(1, 10, ErrorMessage = "学分必须在1到10之间")]
    public int Credits { get; set; }
    
    [StringLength(500, ErrorMessage = "课程描述长度不能超过500个字符")]
    public string Description { get; set; }
    
    [Required(ErrorMessage = "教师姓名不能为空")]
    [StringLength(50, ErrorMessage = "教师姓名长度不能超过50个字符")]
    public string TeacherName { get; set; }
    
    [Required(ErrorMessage = "总课时不能为空")]
    [Range(1, 200, ErrorMessage = "总课时必须在1到200之间")]
    public int TotalHours { get; set; }
    
    [Required(ErrorMessage = "班级ID不能为空")]
    public int ClassId { get; set; }
    
    // 用于显示的班级名称
    public string ClassName { get; set; }
}